/***************************************************************************
 *   Copyright (C) 2005 by xihe   *
 *   xihels@163.com                                                        *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#ifndef _CLUSTER_OPERATE_H_
#define _CLUSTER_OPERATE_H_
#include "Packet.h"
#include <vector>
using std::vector;
/**
 * 得到群的信息请求包，格式为：
 * 1. 头部
 * 2. 群命令类型，1字节，得到信息是0x04
 * 3. 群内部ID，4字节
 * 4. 尾部
 */

class GetClusterInfoPacket : public OutPacket {
    public:
	GetClusterInfoPacket(QQClient& cl,
		uint32_t _clusterId) :

	    OutPacket(cl, 
		    QQ_CMD_CLUSTER_CMD,
		    SEND_COUNT),
	    clusterId(_clusterId)
	{}
	int putBody(uint8_t* buf) const;
    private:
	uint32_t clusterId;
};

/**
 * 得到群中成员信息的请求包，格式为：
 * 1. 头部
 * 2. 命令类型，得到成员信息是0x0C
 * 3. 群内部ID，4字节
 * 4. 需要得到信息的成员QQ号，4字节
 * 5. 如果要得到多个成员的信息，重复4部分
 * 6. 尾部
 * 
 * 注意：一次最多只能得到61个成员信息，而实际操作中我们按照30个一组来得到
 */

class GetClusterMemberInfoPacket : public OutPacket {
    public:
	typedef vector<uint32_t> Members;
	GetClusterMemberInfoPacket(
		QQClient& cl,
		uint32_t _clusterId,
		const Members& _members) :
	    OutPacket(cl,
		    QQ_CMD_CLUSTER_CMD, 
		    SEND_COUNT),
	    clusterId(_clusterId),
	    members(_members)
	{}
	int putBody(uint8_t* buf) const;
    private:
	Members	    members;
	uint32_t    clusterId;
};

/**
 * 得到在线成员的请求包，格式为：
 * 1. 头部
 * 2. 命令类型，得到成员信息是0x0B
 * 3. 群内部ID，4字节
 * 4. 尾部
 */

class GetClusterOnlineMemberPacket : public OutPacket {
    public:
	GetClusterOnlineMemberPacket(QQClient& cl,
		uint32_t _clusterId) :
	    OutPacket(cl,
		    QQ_CMD_CLUSTER_CMD, 
		    SEND_COUNT ),
	    clusterId(_clusterId)
	{}
	int putBody(uint8_t* buf) const;
    private:
	uint32_t clusterId;
};
#endif // _CLUSTER_OPERATE_H_

